package com.driving.single.common.content.service.impl;

import com.driving.single.common.content.service.CommonRecommendService;
import com.driving.single.common.domain.TbContentRecommend;
import com.driving.single.common.mapper.TbContentRecommendMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class CommonRecommendServiceImpl implements CommonRecommendService {
    @Autowired
    private TbContentRecommendMapper tbContentRecommendMapper;
    @Override
    public List<TbContentRecommend> selectTbContentRecommendsByCid(Long categoryId) {
        Example example = new Example(TbContentRecommend.class);
        // ASC升序
        example.setOrderByClause("`sort_order` ASC");
        example.createCriteria().andEqualTo("categoryId", categoryId);
        return this.tbContentRecommendMapper.selectByExample(example);
    }
}
